package com.xiaohong.user.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaohong.user.fallback.ChatFriendFallback;
import com.xiaohong.user.pojo.Friend;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name="xiaohong-chat-user",contextId = "chatFriend",fallback= ChatFriendFallback.class)
public interface ChatFriendFeign {

    /***
     * 分页条件搜索实现ChatFriend
     * @param friend
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "/chatFriend/search/{page}/{size}")
    Result<Page> findPage(@RequestBody(required = false) Friend friend, @PathVariable int page, @PathVariable int size);

    /***
     * 分页搜索实现ChatFriend
     * @param page:当前页
     * @param size:每页显示多少条
     * @return
     */
    @GetMapping(value = "/chatFriend/search/{page}/{size}")
    Result<Page> findPage(@PathVariable int page, @PathVariable int size);

    /***
     * 多条件搜索ChatFriend数据
     * @param friend
     * @return
     */
    @PostMapping(value = "/chatFriend/search")
    Result<List<Friend>>findList(@RequestBody(required = false) Friend friend);

    /***
     * 根据Id删除chatFriend数据
     * @param id
     * @return
     */
    @DeleteMapping(value = "/chatFriend/{id}")
    Result delete(@PathVariable Integer id);

    /***
     * 根据ID修改ChatFriend数据
     * @param friend
     * @param id
     * @return
     */
    @PutMapping(value = "/chatFriend/{id}")
    Result update(@RequestBody Friend friend, @PathVariable Integer id);

    /***
     * 新增ChatFriend数据
     * @param friend
     * @return
     */
    @PostMapping(value = "/chatFriend")
    Result add(@RequestBody Friend friend);

    /***
     * 根据ID查询ChatFriend数据
     * @param id
     * @return
     */
    @GetMapping("/chatFriend/{id}")
    Result<Friend>findById(@PathVariable Integer id);

    /**
     * 判断是否是好友
     * @param fd
     * @return
     */
    @PostMapping("/chatFriend/isFriend")
    Result<Boolean> isFriend(@RequestBody Friend fd);

    /***
     * 查询ChatFriend全部数据
     * @return
     */
    @GetMapping(value = "/chatFriend")
    Result<List<Friend>>findAll();

}
